
include('shared.lua')

/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()	

	self.Entity:SetCollisionBounds( Vector( -32, -32, -32 ), Vector( 32, 32, 0 ) )
	self.Entity:SetSolid( SOLID_NONE )
	
	self.DrawAngleYaw = 0
end
local matLight 		= Material( "ss/light" )

/*---------------------------------------------------------
   Name: DrawPre
---------------------------------------------------------*/
function ENT:Draw()

	// nasty nasty hack
	// but I can't think of an easier way to do this

	// Place the camera a tiny bit closer to the entity - so it draw a tiny bit bigger
	local LPos = self.Entity:GetPos()
	local EyeNormal = self.Entity:GetPos() - EyePos()
	local Distance = EyeNormal:Length()
	EyeNormal:Normalize()
	local Pos = EyePos() + EyeNormal * Distance * 0.15

	if (self:GetPickupItem() == "health") then		Pos.z = Pos.z - 24		LPos.z = LPos.z + 24
	elseif (self:GetPickupItem() == "ammo") then	Pos.z = Pos.z - 24		LPos.z = LPos.z + 24
	end

	render.SetMaterial( matLight )
	render.DrawSprite( LPos, 120, 120, Color( 255, 255, 255, 255 ) )
	
	cam.Start3D( Pos, EyeAngles() )


		local angCopy = self.Entity:GetAngles()
		local ang = self.Entity:GetAngles()
		ang:RotateAroundAxis( Vector(0,0,1), self.DrawAngleYaw )
		self.Entity:SetAngles(ang)

		self.Entity:DrawModel()

		self.DrawAngleYaw = self.DrawAngleYaw + 1
		self.Entity:SetAngles(angCopy)
		
	cam.End3D()
	
	
end
